# !ResEd shell Makefile

# ****** EDIT MAKEPROTO, NOT MAKEFILE ******
# Then construct Makefile using "amu -f MakeProto depend"

# PROGDIR should be set to the application's install directory

# Can set:
#  CFLAGS     -  additional cc options
#  INCLUDES   -  locations to search for "included" files
#  AFLAGS     -  additional objasm options
#  LDFLAGS    -  additional link options

INCLUDES = -I^.common

CPFLAGS = A~C~DF~L~N~P~Q~R~S~T~V

LIBS = ^.common.o.commonlib C:o.Stubs

CFILES = main.c document.c dragdrop.c protocol.c class.c fileinfo.c objflags.c rename.c copy.c genmsgs.c help.c

OFILES = main.o document.o dragdrop.o protocol.o class.o fileinfo.o objflags.o rename.o copy.o genmsgs.o help.o

FILES = ^.!Boot ^.!Help ^.!Run ^.!RunImage ^.!Sprites ^.!Sprites22 ^.Messages ^.Sprites ^.Sprites22 ^.Templates

all: ^.!RunImage
        @echo *** Shell build complete

^.!RunImage: $(OFILES) ^.common.o.commonlib
        cc -c $(CFLAGS) $(INCLUDES) -o ^.common.o.version ^.common.c.version
        link $(LDFLAGS) -o $@ $(OFILES) ^.common.o.version $(LIBS)
        squeeze $@

^.common.o.commonlib:
        dir ^.common
        amu o.commonlib
        dir ^.shell

h.icondefs: ^.Templates
        ^.^.!WinEdit -h ^.Templates > h.icondefs

.c.o:
        cc -c $(CFLAGS) $(INCLUDES) -o $@ $<

.s.o:
        objasm -quit -CloseExec $(AFLAGS) -from $< -to $@

install: $(FILES)
        copy ^.!Boot $(PROGDIR).!Boot $(CPFLAGS)
        copy ^.!Help $(PROGDIR).!Help $(CPFLAGS)
        copy ^.!Run $(PROGDIR).!Run $(CPFLAGS)
        copy ^.!RunImage $(PROGDIR).!RunImage $(CPFLAGS)
        copy ^.!Sprites $(PROGDIR).!Sprites $(CPFLAGS)
        copy ^.!Sprites22 $(PROGDIR).!Sprites22 $(CPFLAGS)
        copy ^.Messages $(PROGDIR).Messages $(CPFLAGS)
        copy ^.Sprites $(PROGDIR).Sprites $(CPFLAGS)
        copy ^.Sprites22 $(PROGDIR).Sprites22 $(CPFLAGS)
        copy ^.Templates $(PROGDIR).Templates $(CPFLAGS)
        @echo *** Shell installation complete

depend:
        copy MakeProto Makefile1 $(CPFLAGS)
        cc -c -M $(INCLUDES) $(CFILES) >> Makefile1
        remove Makefile0
        -rename Makefile Makefile0
        rename Makefile1 Makefile
        @echo *** Shell dependencies established

clean:
       create o.foo
       wipe o.* ~CRF~V
       remove ^.!RunImage
       remove h.icondefs
       @echo *** Shell cleaned

# Dependencies following this line provided by make depend

